
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 05/28/2011 03:09:10
-- Generated from EDMX file: C:\Users\MM\Documents\Visual Studio 2010\Projects\Sisocana\Sisocana.Dal\EntityModels\ModeloAnacosis.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [Sisocana];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_SitioMasterPageCat]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TSitio] DROP CONSTRAINT [FK_SitioMasterPageCat];
GO
IF OBJECT_ID(N'[dbo].[FK_SitioCSSCat]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TSitio] DROP CONSTRAINT [FK_SitioCSSCat];
GO
IF OBJECT_ID(N'[dbo].[FK_SitioUsuario_Sitio]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SitioUsuario] DROP CONSTRAINT [FK_SitioUsuario_Sitio];
GO
IF OBJECT_ID(N'[dbo].[FK_SitioUsuario_Usuario]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SitioUsuario] DROP CONSTRAINT [FK_SitioUsuario_Usuario];
GO
IF OBJECT_ID(N'[dbo].[FK_ONGONGDefinida]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TONGDefinida] DROP CONSTRAINT [FK_ONGONGDefinida];
GO
IF OBJECT_ID(N'[dbo].[FK_SitioONGDefinida]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TONGDefinida] DROP CONSTRAINT [FK_SitioONGDefinida];
GO
IF OBJECT_ID(N'[dbo].[FK_BienesDireccion]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TDonacion_Bienes] DROP CONSTRAINT [FK_BienesDireccion];
GO
IF OBJECT_ID(N'[dbo].[FK_ONGDefinidaDonacion]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TDonacion] DROP CONSTRAINT [FK_ONGDefinidaDonacion];
GO
IF OBJECT_ID(N'[dbo].[FK_SitioPersona]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TPersona] DROP CONSTRAINT [FK_SitioPersona];
GO
IF OBJECT_ID(N'[dbo].[FK_SitioFuenteAsociada]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TImagenAsociado] DROP CONSTRAINT [FK_SitioFuenteAsociada];
GO
IF OBJECT_ID(N'[dbo].[FK_SitiowsBusqueda]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TWsBusqueda] DROP CONSTRAINT [FK_SitiowsBusqueda];
GO
IF OBJECT_ID(N'[dbo].[FK_SitioVideo]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TVideoAsociado] DROP CONSTRAINT [FK_SitioVideo];
GO
IF OBJECT_ID(N'[dbo].[FK_VideoAsociadoVideo]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TVideoAsociado] DROP CONSTRAINT [FK_VideoAsociadoVideo];
GO
IF OBJECT_ID(N'[dbo].[FK_ImagenAsociadoImagenes]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TImagenAsociado] DROP CONSTRAINT [FK_ImagenAsociadoImagenes];
GO
IF OBJECT_ID(N'[dbo].[FK_RedSocialAsociadoRedesSociales]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TRedSocialAsociado] DROP CONSTRAINT [FK_RedSocialAsociadoRedesSociales];
GO
IF OBJECT_ID(N'[dbo].[FK_NoticiaAsociadoNoticias]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TNoticiasAsocido] DROP CONSTRAINT [FK_NoticiaAsociadoNoticias];
GO
IF OBJECT_ID(N'[dbo].[FK_SitioRedSocialAsociado]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TRedSocialAsociado] DROP CONSTRAINT [FK_SitioRedSocialAsociado];
GO
IF OBJECT_ID(N'[dbo].[FK_SitioNoticiaAsociado]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TNoticiasAsocido] DROP CONSTRAINT [FK_SitioNoticiaAsociado];
GO
IF OBJECT_ID(N'[dbo].[FK_MasterPageCatCSSCat]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TCSSCat] DROP CONSTRAINT [FK_MasterPageCatCSSCat];
GO
IF OBJECT_ID(N'[dbo].[FK_SitioDireccion_Sitio]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SitioDireccion] DROP CONSTRAINT [FK_SitioDireccion_Sitio];
GO
IF OBJECT_ID(N'[dbo].[FK_SitioDireccion_Direccion]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SitioDireccion] DROP CONSTRAINT [FK_SitioDireccion_Direccion];
GO
IF OBJECT_ID(N'[dbo].[FK_ONGDefinidaDireccion]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TONGDefinida] DROP CONSTRAINT [FK_ONGDefinidaDireccion];
GO
IF OBJECT_ID(N'[dbo].[FK_PersonaDesaparecidaDireccion]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TPersona_PersonaDesaparecida] DROP CONSTRAINT [FK_PersonaDesaparecidaDireccion];
GO
IF OBJECT_ID(N'[dbo].[FK_ReportesPersonaDesaparecida]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TAnonimo] DROP CONSTRAINT [FK_ReportesPersonaDesaparecida];
GO
IF OBJECT_ID(N'[dbo].[FK_SitioLocalidad]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[Localidades] DROP CONSTRAINT [FK_SitioLocalidad];
GO
IF OBJECT_ID(N'[dbo].[FK_Bienes_inherits_Donacion]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TDonacion_Bienes] DROP CONSTRAINT [FK_Bienes_inherits_Donacion];
GO
IF OBJECT_ID(N'[dbo].[FK_Video_inherits_Fuente]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TFuente_Video] DROP CONSTRAINT [FK_Video_inherits_Fuente];
GO
IF OBJECT_ID(N'[dbo].[FK_Imagenes_inherits_Fuente]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TFuente_Imagenes] DROP CONSTRAINT [FK_Imagenes_inherits_Fuente];
GO
IF OBJECT_ID(N'[dbo].[FK_RedesSociales_inherits_Fuente]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TFuente_RedesSociales] DROP CONSTRAINT [FK_RedesSociales_inherits_Fuente];
GO
IF OBJECT_ID(N'[dbo].[FK_Noticias_inherits_Fuente]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TFuente_Noticias] DROP CONSTRAINT [FK_Noticias_inherits_Fuente];
GO
IF OBJECT_ID(N'[dbo].[FK_PersonaDesaparecida_inherits_Persona]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TPersona_PersonaDesaparecida] DROP CONSTRAINT [FK_PersonaDesaparecida_inherits_Persona];
GO
IF OBJECT_ID(N'[dbo].[FK_Economica_inherits_Donacion]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TDonacion_Economica] DROP CONSTRAINT [FK_Economica_inherits_Donacion];
GO
IF OBJECT_ID(N'[dbo].[FK_Servicios_inherits_Donacion]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TDonacion_Servicios] DROP CONSTRAINT [FK_Servicios_inherits_Donacion];
GO
IF OBJECT_ID(N'[dbo].[FK_PersonaAyuda_inherits_Persona]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TPersona_PersonaAyuda] DROP CONSTRAINT [FK_PersonaAyuda_inherits_Persona];
GO

-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[TUsuario]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TUsuario];
GO
IF OBJECT_ID(N'[dbo].[TSitio]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TSitio];
GO
IF OBJECT_ID(N'[dbo].[TMasterPageCat]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TMasterPageCat];
GO
IF OBJECT_ID(N'[dbo].[TCSSCat]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TCSSCat];
GO
IF OBJECT_ID(N'[dbo].[TFuente]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TFuente];
GO
IF OBJECT_ID(N'[dbo].[TONG]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TONG];
GO
IF OBJECT_ID(N'[dbo].[TONGDefinida]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TONGDefinida];
GO
IF OBJECT_ID(N'[dbo].[TDonacion]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TDonacion];
GO
IF OBJECT_ID(N'[dbo].[TDireccion]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TDireccion];
GO
IF OBJECT_ID(N'[dbo].[TPersona]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TPersona];
GO
IF OBJECT_ID(N'[dbo].[TImagenAsociado]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TImagenAsociado];
GO
IF OBJECT_ID(N'[dbo].[TAnonimo]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TAnonimo];
GO
IF OBJECT_ID(N'[dbo].[TWsBusqueda]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TWsBusqueda];
GO
IF OBJECT_ID(N'[dbo].[TVideoAsociado]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TVideoAsociado];
GO
IF OBJECT_ID(N'[dbo].[TNoticiasAsocido]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TNoticiasAsocido];
GO
IF OBJECT_ID(N'[dbo].[TRedSocialAsociado]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TRedSocialAsociado];
GO
IF OBJECT_ID(N'[dbo].[Localidades]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Localidades];
GO
IF OBJECT_ID(N'[dbo].[TDonacion_Bienes]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TDonacion_Bienes];
GO
IF OBJECT_ID(N'[dbo].[TFuente_Video]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TFuente_Video];
GO
IF OBJECT_ID(N'[dbo].[TFuente_Imagenes]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TFuente_Imagenes];
GO
IF OBJECT_ID(N'[dbo].[TFuente_RedesSociales]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TFuente_RedesSociales];
GO
IF OBJECT_ID(N'[dbo].[TFuente_Noticias]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TFuente_Noticias];
GO
IF OBJECT_ID(N'[dbo].[TPersona_PersonaDesaparecida]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TPersona_PersonaDesaparecida];
GO
IF OBJECT_ID(N'[dbo].[TDonacion_Economica]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TDonacion_Economica];
GO
IF OBJECT_ID(N'[dbo].[TDonacion_Servicios]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TDonacion_Servicios];
GO
IF OBJECT_ID(N'[dbo].[TPersona_PersonaAyuda]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TPersona_PersonaAyuda];
GO
IF OBJECT_ID(N'[dbo].[SitioUsuario]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SitioUsuario];
GO
IF OBJECT_ID(N'[dbo].[SitioDireccion]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SitioDireccion];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'TUsuario'
CREATE TABLE [dbo].[TUsuario] (
    [nombreUsuario] nvarchar(50)  NOT NULL,
    [email] nvarchar(100)  NOT NULL,
    [password] nvarchar(50)  NOT NULL,
    [tipo] nchar(1)  NOT NULL
);
GO

-- Creating table 'TSitio'
CREATE TABLE [dbo].[TSitio] (
    [id] int IDENTITY(1,1) NOT NULL,
    [nombreCatastrofe] nvarchar(100)  NOT NULL,
    [tituloWeb] nvarchar(50)  NOT NULL,
    [subtituloWeb] nvarchar(50)  NOT NULL,
    [descripcion] nvarchar(200)  NOT NULL,
    [fecha] datetime  NOT NULL,
    [subdominio] nvarchar(200)  NOT NULL,
    [mensajeHeader] nvarchar(500)  NOT NULL,
    [mensajeFooter] nvarchar(500)  NOT NULL,
    [imgHeader_imgNombre] nvarchar(100)  NULL,
    [imgHeader_imgExt] nvarchar(10)  NULL,
    [imgHeader_imgByte] varbinary(max)  NULL,
    [imgFooter_imgNombre] nvarchar(100)  NULL,
    [imgFooter_imgExt] nvarchar(10)  NULL,
    [imgFooter_imgByte] varbinary(max)  NULL,
    [imgFondo_imgNombre] nvarchar(100)  NULL,
    [imgFondo_imgExt] nvarchar(10)  NULL,
    [imgFondo_imgByte] varbinary(max)  NULL,
    [estado] nchar(1)  NOT NULL,
    [imgLogo_imgNombre] nvarchar(100)  NULL,
    [imgLogo_imgExt] nvarchar(10)  NULL,
    [imgLogo_imgByte] varbinary(max)  NULL,
    [MasterPageCat_nombreMaster] nvarchar(50)  NOT NULL,
    [CSSCat_nombreCSS] nvarchar(50)  NOT NULL
);
GO

-- Creating table 'TMasterPageCat'
CREATE TABLE [dbo].[TMasterPageCat] (
    [nombreMaster] nvarchar(50)  NOT NULL,
    [descripcion] nvarchar(200)  NOT NULL,
    [path] nvarchar(300)  NOT NULL
);
GO

-- Creating table 'TCSSCat'
CREATE TABLE [dbo].[TCSSCat] (
    [nombreCSS] nvarchar(50)  NOT NULL,
    [descripcion] nvarchar(200)  NOT NULL,
    [path] nvarchar(300)  NOT NULL,
    [MasterPageCat_nombreMaster] nvarchar(50)  NOT NULL
);
GO

-- Creating table 'TFuente'
CREATE TABLE [dbo].[TFuente] (
    [nombre] nchar(50)  NOT NULL,
    [descripcion] nchar(200)  NOT NULL,
    [logo_imgNombre] nvarchar(100)  NULL,
    [logo_imgExt] nvarchar(10)  NULL,
    [logo_imgByte] varbinary(max)  NULL,
    [pagWeb] nchar(100)  NULL
);
GO

-- Creating table 'TONG'
CREATE TABLE [dbo].[TONG] (
    [id] int IDENTITY(1,1) NOT NULL,
    [nombre] nchar(100)  NOT NULL,
    [descripcion] nchar(200)  NOT NULL,
    [urlGeneral] nchar(300)  NULL,
    [estado] nchar(1)  NOT NULL
);
GO

-- Creating table 'TONGDefinida'
CREATE TABLE [dbo].[TONGDefinida] (
    [id] int IDENTITY(1,1) NOT NULL,
    [estadoDefinido] nchar(1)  NOT NULL,
    [telefono] nchar(50)  NOT NULL,
    [paypalLogin] nchar(200)  NULL,
    [paypalPartner] nchar(200)  NULL,
    [nombreONGDefinida] nchar(100)  NOT NULL,
    [ONG_id] int  NOT NULL,
    [Sitio_id] int  NOT NULL,
    [Direccion_id] int  NOT NULL
);
GO

-- Creating table 'TDonacion'
CREATE TABLE [dbo].[TDonacion] (
    [id] int IDENTITY(1,1) NOT NULL,
    [fecha] datetime  NOT NULL,
    [ONGDefinida_id] int  NOT NULL
);
GO

-- Creating table 'TDireccion'
CREATE TABLE [dbo].[TDireccion] (
    [id] int IDENTITY(1,1) NOT NULL,
    [CoordX] nvarchar(100)  NULL,
    [CoordY] nvarchar(100)  NULL,
    [Pais] nvarchar(100)  NULL,
    [Estado] nvarchar(100)  NULL,
    [Ciudad] nvarchar(100)  NULL,
    [Dir] nvarchar(100)  NOT NULL,
    [CP] nvarchar(100)  NULL
);
GO

-- Creating table 'TPersona'
CREATE TABLE [dbo].[TPersona] (
    [id] int IDENTITY(1,1) NOT NULL,
    [nombre] nvarchar(50)  NOT NULL,
    [apellido] nvarchar(50)  NULL,
    [foto_imgNombre] nvarchar(100)  NULL,
    [foto_imgExt] nvarchar(10)  NULL,
    [foto_imgByte] varbinary(max)  NULL,
    [fecha] datetime  NOT NULL,
    [Sitio_id] int  NOT NULL
);
GO

-- Creating table 'TImagenAsociado'
CREATE TABLE [dbo].[TImagenAsociado] (
    [cantVisualizar] int  NOT NULL,
    [tagBusqueda] nchar(50)  NOT NULL,
    [photoSetId] nchar(100)  NOT NULL,
    [appSecret] nchar(150)  NOT NULL,
    [autWindows] nchar(150)  NOT NULL,
    [apiKey] nchar(150)  NOT NULL,
    [id] int IDENTITY(1,1) NOT NULL,
    [width] int  NOT NULL,
    [heigth] int  NOT NULL,
    [Sitio_id] int  NOT NULL,
    [Imagenes_nombre] nchar(50)  NOT NULL
);
GO

-- Creating table 'TAnonimo'
CREATE TABLE [dbo].[TAnonimo] (
    [id] int IDENTITY(1,1) NOT NULL,
    [nombre] nvarchar(50)  NOT NULL,
    [apellido] nvarchar(50)  NOT NULL,
    [email] nvarchar(100)  NOT NULL,
    [telefono] nvarchar(50)  NULL,
    [coordX] nvarchar(50)  NULL,
    [coordY] nvarchar(50)  NULL,
    [status] nchar(1)  NOT NULL,
    [mensaje] nvarchar(100)  NOT NULL,
    [fecha] datetime  NOT NULL,
    [PersonaDesaparecida_id] int  NULL
);
GO

-- Creating table 'TWsBusqueda'
CREATE TABLE [dbo].[TWsBusqueda] (
    [id] int IDENTITY(1,1) NOT NULL,
    [url] nvarchar(max)  NOT NULL,
    [nombre] nvarchar(max)  NOT NULL,
    [descripcion] nvarchar(max)  NOT NULL,
    [Sitio_id] int  NOT NULL
);
GO

-- Creating table 'TVideoAsociado'
CREATE TABLE [dbo].[TVideoAsociado] (
    [apiKey] nchar(150)  NOT NULL,
    [cantVisualizar] int  NOT NULL,
    [tagBusqueda] nchar(50)  NOT NULL,
    [id] int IDENTITY(1,1) NOT NULL,
    [tipo] nchar(20)  NOT NULL,
    [width] int  NOT NULL,
    [heigth] int  NOT NULL,
    [Sitio_id] int  NOT NULL,
    [Video_nombre] nchar(50)  NOT NULL
);
GO

-- Creating table 'TNoticiasAsocido'
CREATE TABLE [dbo].[TNoticiasAsocido] (
    [cantVisualizar] int  NOT NULL,
    [tagBusqueda] nchar(50)  NOT NULL,
    [id] int IDENTITY(1,1) NOT NULL,
    [showDesc] bit  NOT NULL,
    [Noticias_nombre] nchar(50)  NOT NULL,
    [Sitio_id] int  NOT NULL
);
GO

-- Creating table 'TRedSocialAsociado'
CREATE TABLE [dbo].[TRedSocialAsociado] (
    [cantVisualizar] int  NOT NULL,
    [tagBusqueda] nchar(50)  NOT NULL,
    [tagUser] nchar(50)  NOT NULL,
    [id] int IDENTITY(1,1) NOT NULL,
    [width] int  NOT NULL,
    [heigth] int  NOT NULL,
    [BackgroundShellColor] nvarchar(max)  NOT NULL,
    [ShellColor] nvarchar(max)  NOT NULL,
    [BackgroundTweetsColor] nvarchar(max)  NOT NULL,
    [TweetsColor] nvarchar(max)  NOT NULL,
    [RedesSociales_nombre] nchar(50)  NOT NULL,
    [Sitio_id] int  NOT NULL
);
GO

-- Creating table 'Localidades'
CREATE TABLE [dbo].[Localidades] (
    [id] int IDENTITY(1,1) NOT NULL,
    [nombre] nvarchar(50)  NOT NULL,
    [descripcion] nvarchar(250)  NOT NULL,
    [latitud] nvarchar(50)  NOT NULL,
    [longitud] nvarchar(50)  NOT NULL,
    [Sitio_id] int  NOT NULL
);
GO

-- Creating table 'TDonacion_Bienes'
CREATE TABLE [dbo].[TDonacion_Bienes] (
    [nombreDelBien] nchar(100)  NOT NULL,
    [cantidadDelBien] smallint  NOT NULL,
    [descripcionDonacion] nchar(200)  NOT NULL,
    [id] int  NOT NULL,
    [Direccion_id] int  NOT NULL
);
GO

-- Creating table 'TFuente_Video'
CREATE TABLE [dbo].[TFuente_Video] (
    [nombre] nchar(50)  NOT NULL
);
GO

-- Creating table 'TFuente_Imagenes'
CREATE TABLE [dbo].[TFuente_Imagenes] (
    [nombre] nchar(50)  NOT NULL
);
GO

-- Creating table 'TFuente_RedesSociales'
CREATE TABLE [dbo].[TFuente_RedesSociales] (
    [nombre] nchar(50)  NOT NULL
);
GO

-- Creating table 'TFuente_Noticias'
CREATE TABLE [dbo].[TFuente_Noticias] (
    [url] nchar(300)  NOT NULL,
    [nombre] nchar(50)  NOT NULL
);
GO

-- Creating table 'TPersona_PersonaDesaparecida'
CREATE TABLE [dbo].[TPersona_PersonaDesaparecida] (
    [celular] nvarchar(50)  NULL,
    [descripcion] nvarchar(100)  NULL,
    [edad] int  NULL,
    [sexo] nchar(1)  NULL,
    [id] int  NOT NULL,
    [Direccion_id] int  NOT NULL
);
GO

-- Creating table 'TDonacion_Economica'
CREATE TABLE [dbo].[TDonacion_Economica] (
    [nombreTitular] nchar(50)  NULL,
    [numeroTarjeta] nchar(100)  NULL,
    [tipoTarjeta] nchar(10)  NULL,
    [fechaVencimiento] datetime  NULL,
    [cVVNumber] nchar(20)  NULL,
    [monto] int  NOT NULL,
    [conPaypal] bit  NOT NULL,
    [paypalpayerID] nchar(150)  NULL,
    [paypalToken] nchar(150)  NULL,
    [id] int  NOT NULL
);
GO

-- Creating table 'TDonacion_Servicios'
CREATE TABLE [dbo].[TDonacion_Servicios] (
    [nombreDelServicio] nchar(50)  NOT NULL,
    [formaDonacion] nchar(100)  NOT NULL,
    [descripcion] nchar(300)  NOT NULL,
    [id] int  NOT NULL
);
GO

-- Creating table 'TPersona_PersonaAyuda'
CREATE TABLE [dbo].[TPersona_PersonaAyuda] (
    [descripcionSituacion] nchar(100)  NULL,
    [coordX] nchar(100)  NULL,
    [coordY] nchar(100)  NULL,
    [id] int  NOT NULL
);
GO

-- Creating table 'SitioUsuario'
CREATE TABLE [dbo].[SitioUsuario] (
    [Sitio_id] int  NOT NULL,
    [Usuario_nombreUsuario] nvarchar(50)  NOT NULL
);
GO

-- Creating table 'SitioDireccion'
CREATE TABLE [dbo].[SitioDireccion] (
    [Sitio_id] int  NOT NULL,
    [Direccion_id] int  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [nombreUsuario] in table 'TUsuario'
ALTER TABLE [dbo].[TUsuario]
ADD CONSTRAINT [PK_TUsuario]
    PRIMARY KEY CLUSTERED ([nombreUsuario] ASC);
GO

-- Creating primary key on [id] in table 'TSitio'
ALTER TABLE [dbo].[TSitio]
ADD CONSTRAINT [PK_TSitio]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [nombreMaster] in table 'TMasterPageCat'
ALTER TABLE [dbo].[TMasterPageCat]
ADD CONSTRAINT [PK_TMasterPageCat]
    PRIMARY KEY CLUSTERED ([nombreMaster] ASC);
GO

-- Creating primary key on [nombreCSS] in table 'TCSSCat'
ALTER TABLE [dbo].[TCSSCat]
ADD CONSTRAINT [PK_TCSSCat]
    PRIMARY KEY CLUSTERED ([nombreCSS] ASC);
GO

-- Creating primary key on [nombre] in table 'TFuente'
ALTER TABLE [dbo].[TFuente]
ADD CONSTRAINT [PK_TFuente]
    PRIMARY KEY CLUSTERED ([nombre] ASC);
GO

-- Creating primary key on [id] in table 'TONG'
ALTER TABLE [dbo].[TONG]
ADD CONSTRAINT [PK_TONG]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TONGDefinida'
ALTER TABLE [dbo].[TONGDefinida]
ADD CONSTRAINT [PK_TONGDefinida]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TDonacion'
ALTER TABLE [dbo].[TDonacion]
ADD CONSTRAINT [PK_TDonacion]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TDireccion'
ALTER TABLE [dbo].[TDireccion]
ADD CONSTRAINT [PK_TDireccion]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TPersona'
ALTER TABLE [dbo].[TPersona]
ADD CONSTRAINT [PK_TPersona]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TImagenAsociado'
ALTER TABLE [dbo].[TImagenAsociado]
ADD CONSTRAINT [PK_TImagenAsociado]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TAnonimo'
ALTER TABLE [dbo].[TAnonimo]
ADD CONSTRAINT [PK_TAnonimo]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TWsBusqueda'
ALTER TABLE [dbo].[TWsBusqueda]
ADD CONSTRAINT [PK_TWsBusqueda]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TVideoAsociado'
ALTER TABLE [dbo].[TVideoAsociado]
ADD CONSTRAINT [PK_TVideoAsociado]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TNoticiasAsocido'
ALTER TABLE [dbo].[TNoticiasAsocido]
ADD CONSTRAINT [PK_TNoticiasAsocido]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TRedSocialAsociado'
ALTER TABLE [dbo].[TRedSocialAsociado]
ADD CONSTRAINT [PK_TRedSocialAsociado]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'Localidades'
ALTER TABLE [dbo].[Localidades]
ADD CONSTRAINT [PK_Localidades]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TDonacion_Bienes'
ALTER TABLE [dbo].[TDonacion_Bienes]
ADD CONSTRAINT [PK_TDonacion_Bienes]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [nombre] in table 'TFuente_Video'
ALTER TABLE [dbo].[TFuente_Video]
ADD CONSTRAINT [PK_TFuente_Video]
    PRIMARY KEY CLUSTERED ([nombre] ASC);
GO

-- Creating primary key on [nombre] in table 'TFuente_Imagenes'
ALTER TABLE [dbo].[TFuente_Imagenes]
ADD CONSTRAINT [PK_TFuente_Imagenes]
    PRIMARY KEY CLUSTERED ([nombre] ASC);
GO

-- Creating primary key on [nombre] in table 'TFuente_RedesSociales'
ALTER TABLE [dbo].[TFuente_RedesSociales]
ADD CONSTRAINT [PK_TFuente_RedesSociales]
    PRIMARY KEY CLUSTERED ([nombre] ASC);
GO

-- Creating primary key on [nombre] in table 'TFuente_Noticias'
ALTER TABLE [dbo].[TFuente_Noticias]
ADD CONSTRAINT [PK_TFuente_Noticias]
    PRIMARY KEY CLUSTERED ([nombre] ASC);
GO

-- Creating primary key on [id] in table 'TPersona_PersonaDesaparecida'
ALTER TABLE [dbo].[TPersona_PersonaDesaparecida]
ADD CONSTRAINT [PK_TPersona_PersonaDesaparecida]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TDonacion_Economica'
ALTER TABLE [dbo].[TDonacion_Economica]
ADD CONSTRAINT [PK_TDonacion_Economica]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TDonacion_Servicios'
ALTER TABLE [dbo].[TDonacion_Servicios]
ADD CONSTRAINT [PK_TDonacion_Servicios]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [id] in table 'TPersona_PersonaAyuda'
ALTER TABLE [dbo].[TPersona_PersonaAyuda]
ADD CONSTRAINT [PK_TPersona_PersonaAyuda]
    PRIMARY KEY CLUSTERED ([id] ASC);
GO

-- Creating primary key on [Sitio_id], [Usuario_nombreUsuario] in table 'SitioUsuario'
ALTER TABLE [dbo].[SitioUsuario]
ADD CONSTRAINT [PK_SitioUsuario]
    PRIMARY KEY NONCLUSTERED ([Sitio_id], [Usuario_nombreUsuario] ASC);
GO

-- Creating primary key on [Sitio_id], [Direccion_id] in table 'SitioDireccion'
ALTER TABLE [dbo].[SitioDireccion]
ADD CONSTRAINT [PK_SitioDireccion]
    PRIMARY KEY NONCLUSTERED ([Sitio_id], [Direccion_id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [MasterPageCat_nombreMaster] in table 'TSitio'
ALTER TABLE [dbo].[TSitio]
ADD CONSTRAINT [FK_SitioMasterPageCat]
    FOREIGN KEY ([MasterPageCat_nombreMaster])
    REFERENCES [dbo].[TMasterPageCat]
        ([nombreMaster])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SitioMasterPageCat'
CREATE INDEX [IX_FK_SitioMasterPageCat]
ON [dbo].[TSitio]
    ([MasterPageCat_nombreMaster]);
GO

-- Creating foreign key on [CSSCat_nombreCSS] in table 'TSitio'
ALTER TABLE [dbo].[TSitio]
ADD CONSTRAINT [FK_SitioCSSCat]
    FOREIGN KEY ([CSSCat_nombreCSS])
    REFERENCES [dbo].[TCSSCat]
        ([nombreCSS])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SitioCSSCat'
CREATE INDEX [IX_FK_SitioCSSCat]
ON [dbo].[TSitio]
    ([CSSCat_nombreCSS]);
GO

-- Creating foreign key on [Sitio_id] in table 'SitioUsuario'
ALTER TABLE [dbo].[SitioUsuario]
ADD CONSTRAINT [FK_SitioUsuario_Sitio]
    FOREIGN KEY ([Sitio_id])
    REFERENCES [dbo].[TSitio]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [Usuario_nombreUsuario] in table 'SitioUsuario'
ALTER TABLE [dbo].[SitioUsuario]
ADD CONSTRAINT [FK_SitioUsuario_Usuario]
    FOREIGN KEY ([Usuario_nombreUsuario])
    REFERENCES [dbo].[TUsuario]
        ([nombreUsuario])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SitioUsuario_Usuario'
CREATE INDEX [IX_FK_SitioUsuario_Usuario]
ON [dbo].[SitioUsuario]
    ([Usuario_nombreUsuario]);
GO

-- Creating foreign key on [ONG_id] in table 'TONGDefinida'
ALTER TABLE [dbo].[TONGDefinida]
ADD CONSTRAINT [FK_ONGONGDefinida]
    FOREIGN KEY ([ONG_id])
    REFERENCES [dbo].[TONG]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ONGONGDefinida'
CREATE INDEX [IX_FK_ONGONGDefinida]
ON [dbo].[TONGDefinida]
    ([ONG_id]);
GO

-- Creating foreign key on [Sitio_id] in table 'TONGDefinida'
ALTER TABLE [dbo].[TONGDefinida]
ADD CONSTRAINT [FK_SitioONGDefinida]
    FOREIGN KEY ([Sitio_id])
    REFERENCES [dbo].[TSitio]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SitioONGDefinida'
CREATE INDEX [IX_FK_SitioONGDefinida]
ON [dbo].[TONGDefinida]
    ([Sitio_id]);
GO

-- Creating foreign key on [Direccion_id] in table 'TDonacion_Bienes'
ALTER TABLE [dbo].[TDonacion_Bienes]
ADD CONSTRAINT [FK_BienesDireccion]
    FOREIGN KEY ([Direccion_id])
    REFERENCES [dbo].[TDireccion]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_BienesDireccion'
CREATE INDEX [IX_FK_BienesDireccion]
ON [dbo].[TDonacion_Bienes]
    ([Direccion_id]);
GO

-- Creating foreign key on [ONGDefinida_id] in table 'TDonacion'
ALTER TABLE [dbo].[TDonacion]
ADD CONSTRAINT [FK_ONGDefinidaDonacion]
    FOREIGN KEY ([ONGDefinida_id])
    REFERENCES [dbo].[TONGDefinida]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ONGDefinidaDonacion'
CREATE INDEX [IX_FK_ONGDefinidaDonacion]
ON [dbo].[TDonacion]
    ([ONGDefinida_id]);
GO

-- Creating foreign key on [Sitio_id] in table 'TPersona'
ALTER TABLE [dbo].[TPersona]
ADD CONSTRAINT [FK_SitioPersona]
    FOREIGN KEY ([Sitio_id])
    REFERENCES [dbo].[TSitio]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SitioPersona'
CREATE INDEX [IX_FK_SitioPersona]
ON [dbo].[TPersona]
    ([Sitio_id]);
GO

-- Creating foreign key on [Sitio_id] in table 'TImagenAsociado'
ALTER TABLE [dbo].[TImagenAsociado]
ADD CONSTRAINT [FK_SitioFuenteAsociada]
    FOREIGN KEY ([Sitio_id])
    REFERENCES [dbo].[TSitio]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SitioFuenteAsociada'
CREATE INDEX [IX_FK_SitioFuenteAsociada]
ON [dbo].[TImagenAsociado]
    ([Sitio_id]);
GO

-- Creating foreign key on [Sitio_id] in table 'TWsBusqueda'
ALTER TABLE [dbo].[TWsBusqueda]
ADD CONSTRAINT [FK_SitiowsBusqueda]
    FOREIGN KEY ([Sitio_id])
    REFERENCES [dbo].[TSitio]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SitiowsBusqueda'
CREATE INDEX [IX_FK_SitiowsBusqueda]
ON [dbo].[TWsBusqueda]
    ([Sitio_id]);
GO

-- Creating foreign key on [Sitio_id] in table 'TVideoAsociado'
ALTER TABLE [dbo].[TVideoAsociado]
ADD CONSTRAINT [FK_SitioVideo]
    FOREIGN KEY ([Sitio_id])
    REFERENCES [dbo].[TSitio]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SitioVideo'
CREATE INDEX [IX_FK_SitioVideo]
ON [dbo].[TVideoAsociado]
    ([Sitio_id]);
GO

-- Creating foreign key on [Video_nombre] in table 'TVideoAsociado'
ALTER TABLE [dbo].[TVideoAsociado]
ADD CONSTRAINT [FK_VideoAsociadoVideo]
    FOREIGN KEY ([Video_nombre])
    REFERENCES [dbo].[TFuente_Video]
        ([nombre])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_VideoAsociadoVideo'
CREATE INDEX [IX_FK_VideoAsociadoVideo]
ON [dbo].[TVideoAsociado]
    ([Video_nombre]);
GO

-- Creating foreign key on [Imagenes_nombre] in table 'TImagenAsociado'
ALTER TABLE [dbo].[TImagenAsociado]
ADD CONSTRAINT [FK_ImagenAsociadoImagenes]
    FOREIGN KEY ([Imagenes_nombre])
    REFERENCES [dbo].[TFuente_Imagenes]
        ([nombre])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ImagenAsociadoImagenes'
CREATE INDEX [IX_FK_ImagenAsociadoImagenes]
ON [dbo].[TImagenAsociado]
    ([Imagenes_nombre]);
GO

-- Creating foreign key on [RedesSociales_nombre] in table 'TRedSocialAsociado'
ALTER TABLE [dbo].[TRedSocialAsociado]
ADD CONSTRAINT [FK_RedSocialAsociadoRedesSociales]
    FOREIGN KEY ([RedesSociales_nombre])
    REFERENCES [dbo].[TFuente_RedesSociales]
        ([nombre])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_RedSocialAsociadoRedesSociales'
CREATE INDEX [IX_FK_RedSocialAsociadoRedesSociales]
ON [dbo].[TRedSocialAsociado]
    ([RedesSociales_nombre]);
GO

-- Creating foreign key on [Noticias_nombre] in table 'TNoticiasAsocido'
ALTER TABLE [dbo].[TNoticiasAsocido]
ADD CONSTRAINT [FK_NoticiaAsociadoNoticias]
    FOREIGN KEY ([Noticias_nombre])
    REFERENCES [dbo].[TFuente_Noticias]
        ([nombre])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_NoticiaAsociadoNoticias'
CREATE INDEX [IX_FK_NoticiaAsociadoNoticias]
ON [dbo].[TNoticiasAsocido]
    ([Noticias_nombre]);
GO

-- Creating foreign key on [Sitio_id] in table 'TRedSocialAsociado'
ALTER TABLE [dbo].[TRedSocialAsociado]
ADD CONSTRAINT [FK_SitioRedSocialAsociado]
    FOREIGN KEY ([Sitio_id])
    REFERENCES [dbo].[TSitio]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SitioRedSocialAsociado'
CREATE INDEX [IX_FK_SitioRedSocialAsociado]
ON [dbo].[TRedSocialAsociado]
    ([Sitio_id]);
GO

-- Creating foreign key on [Sitio_id] in table 'TNoticiasAsocido'
ALTER TABLE [dbo].[TNoticiasAsocido]
ADD CONSTRAINT [FK_SitioNoticiaAsociado]
    FOREIGN KEY ([Sitio_id])
    REFERENCES [dbo].[TSitio]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SitioNoticiaAsociado'
CREATE INDEX [IX_FK_SitioNoticiaAsociado]
ON [dbo].[TNoticiasAsocido]
    ([Sitio_id]);
GO

-- Creating foreign key on [MasterPageCat_nombreMaster] in table 'TCSSCat'
ALTER TABLE [dbo].[TCSSCat]
ADD CONSTRAINT [FK_MasterPageCatCSSCat]
    FOREIGN KEY ([MasterPageCat_nombreMaster])
    REFERENCES [dbo].[TMasterPageCat]
        ([nombreMaster])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_MasterPageCatCSSCat'
CREATE INDEX [IX_FK_MasterPageCatCSSCat]
ON [dbo].[TCSSCat]
    ([MasterPageCat_nombreMaster]);
GO

-- Creating foreign key on [Sitio_id] in table 'SitioDireccion'
ALTER TABLE [dbo].[SitioDireccion]
ADD CONSTRAINT [FK_SitioDireccion_Sitio]
    FOREIGN KEY ([Sitio_id])
    REFERENCES [dbo].[TSitio]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [Direccion_id] in table 'SitioDireccion'
ALTER TABLE [dbo].[SitioDireccion]
ADD CONSTRAINT [FK_SitioDireccion_Direccion]
    FOREIGN KEY ([Direccion_id])
    REFERENCES [dbo].[TDireccion]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SitioDireccion_Direccion'
CREATE INDEX [IX_FK_SitioDireccion_Direccion]
ON [dbo].[SitioDireccion]
    ([Direccion_id]);
GO

-- Creating foreign key on [Direccion_id] in table 'TONGDefinida'
ALTER TABLE [dbo].[TONGDefinida]
ADD CONSTRAINT [FK_ONGDefinidaDireccion]
    FOREIGN KEY ([Direccion_id])
    REFERENCES [dbo].[TDireccion]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ONGDefinidaDireccion'
CREATE INDEX [IX_FK_ONGDefinidaDireccion]
ON [dbo].[TONGDefinida]
    ([Direccion_id]);
GO

-- Creating foreign key on [Direccion_id] in table 'TPersona_PersonaDesaparecida'
ALTER TABLE [dbo].[TPersona_PersonaDesaparecida]
ADD CONSTRAINT [FK_PersonaDesaparecidaDireccion]
    FOREIGN KEY ([Direccion_id])
    REFERENCES [dbo].[TDireccion]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_PersonaDesaparecidaDireccion'
CREATE INDEX [IX_FK_PersonaDesaparecidaDireccion]
ON [dbo].[TPersona_PersonaDesaparecida]
    ([Direccion_id]);
GO

-- Creating foreign key on [PersonaDesaparecida_id] in table 'TAnonimo'
ALTER TABLE [dbo].[TAnonimo]
ADD CONSTRAINT [FK_ReportesPersonaDesaparecida]
    FOREIGN KEY ([PersonaDesaparecida_id])
    REFERENCES [dbo].[TPersona_PersonaDesaparecida]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ReportesPersonaDesaparecida'
CREATE INDEX [IX_FK_ReportesPersonaDesaparecida]
ON [dbo].[TAnonimo]
    ([PersonaDesaparecida_id]);
GO

-- Creating foreign key on [Sitio_id] in table 'Localidades'
ALTER TABLE [dbo].[Localidades]
ADD CONSTRAINT [FK_SitioLocalidad]
    FOREIGN KEY ([Sitio_id])
    REFERENCES [dbo].[TSitio]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SitioLocalidad'
CREATE INDEX [IX_FK_SitioLocalidad]
ON [dbo].[Localidades]
    ([Sitio_id]);
GO

-- Creating foreign key on [id] in table 'TDonacion_Bienes'
ALTER TABLE [dbo].[TDonacion_Bienes]
ADD CONSTRAINT [FK_Bienes_inherits_Donacion]
    FOREIGN KEY ([id])
    REFERENCES [dbo].[TDonacion]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [nombre] in table 'TFuente_Video'
ALTER TABLE [dbo].[TFuente_Video]
ADD CONSTRAINT [FK_Video_inherits_Fuente]
    FOREIGN KEY ([nombre])
    REFERENCES [dbo].[TFuente]
        ([nombre])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [nombre] in table 'TFuente_Imagenes'
ALTER TABLE [dbo].[TFuente_Imagenes]
ADD CONSTRAINT [FK_Imagenes_inherits_Fuente]
    FOREIGN KEY ([nombre])
    REFERENCES [dbo].[TFuente]
        ([nombre])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [nombre] in table 'TFuente_RedesSociales'
ALTER TABLE [dbo].[TFuente_RedesSociales]
ADD CONSTRAINT [FK_RedesSociales_inherits_Fuente]
    FOREIGN KEY ([nombre])
    REFERENCES [dbo].[TFuente]
        ([nombre])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [nombre] in table 'TFuente_Noticias'
ALTER TABLE [dbo].[TFuente_Noticias]
ADD CONSTRAINT [FK_Noticias_inherits_Fuente]
    FOREIGN KEY ([nombre])
    REFERENCES [dbo].[TFuente]
        ([nombre])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [id] in table 'TPersona_PersonaDesaparecida'
ALTER TABLE [dbo].[TPersona_PersonaDesaparecida]
ADD CONSTRAINT [FK_PersonaDesaparecida_inherits_Persona]
    FOREIGN KEY ([id])
    REFERENCES [dbo].[TPersona]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [id] in table 'TDonacion_Economica'
ALTER TABLE [dbo].[TDonacion_Economica]
ADD CONSTRAINT [FK_Economica_inherits_Donacion]
    FOREIGN KEY ([id])
    REFERENCES [dbo].[TDonacion]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [id] in table 'TDonacion_Servicios'
ALTER TABLE [dbo].[TDonacion_Servicios]
ADD CONSTRAINT [FK_Servicios_inherits_Donacion]
    FOREIGN KEY ([id])
    REFERENCES [dbo].[TDonacion]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [id] in table 'TPersona_PersonaAyuda'
ALTER TABLE [dbo].[TPersona_PersonaAyuda]
ADD CONSTRAINT [FK_PersonaAyuda_inherits_Persona]
    FOREIGN KEY ([id])
    REFERENCES [dbo].[TPersona]
        ([id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------